<template>
  <div>
    <div class="header" :model="form">
      <h4 class="title">评论</h4>
      <textarea
        name
        id
        cols="30"
        rows="3"
        placeholder="说点什么吧..."
        style="resize: none;
    min-height: 33px;width:94%;padding:10px;margin-bottom:10px"
      ></textarea>
      <el-button
        type="primary"
        size="small"
        style="margin-right:20px;float:right;"
        @click="onSubmit"
      >提交</el-button>
      <!-- 照片墙 -->
      <el-upload
        action="https://jsonplaceholder.typicode.com/posts/"
        list-type="picture-card"
        :on-preview="handlePictureCardPreview"
        :on-remove="handleRemove"
      >
        <i class="el-icon-plus"></i>
      </el-upload>
      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="dialogImageUrl" alt />
      </el-dialog>
    </div>
    <div class="comments"></div>
  </div>
</template>

<script>
export default {
  props: ["data"],
  data() {
    return {
        // 存放评论内容
      form: {},
    //   评论参数
        comments:{
            post:1,//文章id
            _sort:"id",//排序
            _limit:10,//条数
            _start:0//开始分页数据
        },
      dialogImageUrl: "",
      dialogVisible: false
    };
  },
  mounted() {
      this.$axios({
          url:"/posts/comments",
          params:this.comments,
      }).then(res=>{
          console.log(res,999);
          
      })
  },
  methods: {
    onSubmit() {},
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    }
  }
};
</script>

<style lang="less" scoped>
.header {
  margin-top: 30px;
  .title {
    font-weight: normal;
    margin-bottom: 20px;
    font-size: 18px;
  }
}
</style>